package com.example.demo;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("demo")
@Slf4j
public class DemoController {
    @Value("${spring.profiles.active}")
    private String active;

    @Value("${server.port}")
    private String port;

    /**
     * dev访问：127.0.0.1:8080/springboot/demo/test001
     * test访问：
     *  127.0.0.1:7000/springboot/demo/test001
     *  127.0.0.1:7001/springboot/demo/test001
     * nginx代理访问：http://127.0.0.1/gateway/springboot/demo/test001
     */
    @GetMapping("test001")
    public String test001() {
        log.info("success:{},{}", active, port);
        return "success：" + active;
    }
}
